package javaz.liquibase.csv;

import java.io.FileWriter;
import java.io.IOException;
import java.io.Writer;
import java.util.ArrayList;
import java.util.List;

import liquibase.util.csv.CSVWriter;

public class ExportCSV {
	
	private static final String CSV_FILE = "/resources/liquibase/ExportData.csv";
	
	public static void main(String[] args) {
		List<String[]> list = new ArrayList<>();
		for (int i = 0; i < 10; i++) {
			String[] line = new String[] {"Col_A_" + i, "Col_B_" + i, "Col_C_" + i, "Col_D_" + i, "Col_D_" + i};
			list.add(line);
		}
		
		try {
			Writer writer = new FileWriter(System.getProperty("user.dir") + CSV_FILE, Boolean.TRUE);
			CSVWriter csvWriter = new CSVWriter(writer, ';', '\"');
			csvWriter.writeAll(list);
			String[] line = new String[] {"Col_A_i", "Col_B_i", "Col_C_i", "Col_D_i", "Col_D_i"};
			csvWriter.writeNext(line);
			csvWriter.flush();
			csvWriter.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
		
	}

}
